package com.example;

import java.util.Arrays;
import java.util.List;

public class ApiInfo {
    //private String className;
    //private String methodName;

    private String path;
    private String httpMethod;
    private List<String> requestParams;
    private String[] paramNames;
    private String returnType;

    public ApiInfo(String path, String httpMethod, List<String> requestParams, String[] paramNames, String returnType) {
        //this.className = className;
        //this.methodName = methodName;

        this.path = path;
        this.httpMethod = httpMethod;
        this.requestParams = requestParams;
        this.paramNames = paramNames;
        this.returnType = returnType;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getHttpMethod() {
        return httpMethod;
    }

    public void setHttpMethod(String httpMethod) {
        this.httpMethod = httpMethod;
    }

    public String getRequestParams() {
        return (requestParams == null || requestParams.isEmpty()) ? "NULL" : String.join(",", requestParams);
    }

    public void setRequestParams(List<String> requestParams) {
        this.requestParams = requestParams;
    }

    public String getParamNames() {
        return (paramNames == null || paramNames.length == 0) ? "NULL" : String.join(",", paramNames);
    }

    public void setParamNames(String[] paramNames) {
        this.paramNames = paramNames;
    }

    public String getReturnType() {
        return returnType;
    }

    public void setReturnType(String returnType) {
        this.returnType = returnType;
    }

    @Override
    public String toString() {
        return "ApiInfo{" +
                "path='" + path + '\'' +
                ", httpMethod='" + httpMethod + '\'' +
                ", requestParams=" + requestParams +
                ", paramNames=" + Arrays.toString(paramNames) +
                ", returnType='" + returnType + '\'' +
                '}';
    }
}
